package com.tom.feignclient;

import com.tom.domain.User;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class UserFeignClientFallback implements FallbackFactory<UserFeignClient> {

    @Override
    public  UserFeignClient create(Throwable throwable) {
        return new UserFeignClient() {
            @Override
            public User getUser(Long id) {
                throwable.printStackTrace();
                return new User("系统繁忙","123");
            }
        };
    }
}
